#ifdef GL_ES
precision highp float;
#endif

uniform vec4 uMatDiffuse;
uniform vec3 uAmbLightColor;
uniform vec3 uDirLightDiffColor;
uniform vec3 uDirLightSpecColor;
uniform vec3 uDirLightVect;

varying vec4 vColor;
varying vec4 vCameraSpacePos;
varying vec4 vCameraSpaceNorm;

void main(void) {
    vec3 eyeVect = normalize(-vCameraSpacePos.xyz);
    vec3 reflectVect = reflect(uDirLightVect, vCameraSpaceNorm.xyz);

    float diffWeight = max(dot(vCameraSpaceNorm.xyz, -uDirLightVect), 0.0);
    vec3 lightWeight = uAmbLightColor + uDirLightDiffColor * diffWeight;
    
    gl_FragColor = vec4(vColor.rgb * lightWeight, vColor.a);
}
